<?php

class UserMessage extends ActiveRecordBase
{
	public static function model($className=__CLASS__)
    {
        return parent::model($className);
    }

	public function tableName() {
		return "{{user_messages}}";
	}

	public function relations() {
		return array(
			'user' => array(self::BELONGS_TO, 'User', 'from_user_id'),
		);
	}

	public function rules()
	{
		return array(
			array('from_user_id, to_user_id', 'required'),
			array('message', 'safe'),
		);
	}
}